/*************************************************
* Title：TinyToolKit
* Author：Opportunity 
* Describe：TinyToolKit配置资源对象
* CreateTime：2020-04-05 18:52:29
* Version：1.0
* Modify Recorder：
*************************************************/

using System;
using System.Collections.Generic;
using System.IO;
using TinyToolKit.AssetLoad;
using TinyToolKit.UI;
using TinyToolKit.Localization;
using UnityEngine;
using UnityEditor;

namespace TinyToolKitEditor
{
    //[CreateAssetMenu(fileName = "TinyToolSetting",menuName = "TinyAsset/TinyTool Setting",order = 1)]
    public class TinyToolEditorSettingAsset : ScriptableObject
    {
        [Header("Setting")] 
        public string appTitle;
        public string author;
        [SerializeField] public string[] ProjectDirList = {"Anims","Audios","Materials","Models","Prefabs","Scenes","Scripts","Shaders","Textures","UI"}; 
        
        [Header("Define")]
        public string constTableName = "TinyDefine";
        public string constTableSavePath;
        [SerializeField] public string[] UIFormType;
        [SerializeField] public string[] ObjectPoolType;
        [SerializeField] public string[] FsmType;
        [SerializeField] public string[] CustomType;

        [Header("UI Form")]
        [SerializeField] public UIFormBase[] UIFormPrefabs;
        public string uiFormConfigName = "UIFormConfigTable";
        public string uiFormSavePath; 

        [Header("AssetBundle")]
        public string assetBundleVariant;
        public BuildPlatform buildTarget = BuildPlatform.ActiveBuildTarget;
        public ABCompressType compressType = ABCompressType.LZ4;
        public string buildSavePath;
        public DataFormat dataFormat;
        public bool isClearAllABName = true;
        public bool deleteUnusedAB = true;  
        public bool deleteABManifest = true;
        public bool encrypt = true;
        public bool spawnVersion = true;
        //单个Prefab文件所在的文件夹路径，会遍历这个文件夹下面所有Prefab，所有Prefab的名字不能重复,必须保证名字的唯一性
        [SerializeField] public List<string> allPrefabDirPath = new List<string>();
        [SerializeField] public List<string> allAssetFileDirPath = new List<string>();  

        [Header("Lan Trans")]
        public Language selectedLan = 0;
        public int selectedLanCategory;
        public string fileName;
        public string filePath;
        public string curCategory;
        public string content;
        public bool isEditMode;
        public bool isEditCategories;
        public List<string> lanCategories = new List<string> { "None" };
        public Translation trans = new Translation();
        public List<TranslationItem> removedKey = new List<TranslationItem>();
        
        public static TinyToolEditorSettingAsset CreateAsset()
        {
            TinyToolEditorSettingAsset asset = CreateInstance<TinyToolEditorSettingAsset>();
            string targetPath = "Assets/TinyToolKit/Editor/Resources";
            if (Directory.Exists(targetPath) == false)
                Directory.CreateDirectory(targetPath);
            
            AssetDatabase.CreateAsset(asset, Path.Combine(targetPath,"TinyToolEditorSetting.asset"));
            AssetDatabase.SaveAssets();
            EditorUtility.FocusProjectWindow();
            Selection.activeObject = asset;
            return asset;
        }
    }

    public enum BuildPlatform
    {
        ActiveBuildTarget,
        /// <summary>
        /// Google Android
        /// </summary>
        Android,
        /// <summary>
        /// Apple iOS
        /// </summary>
        iOS,
        /// <summary>
        /// WebGL
        /// </summary>
        WebGL,
        /// <summary>
        /// Microsoft Windows x64
        /// </summary>
        StandaloneWindows64,
        /// <summary>
        /// GNU Linux
        /// </summary>
        StandaloneLinux64,
        /// <summary>
        /// Apple OSX
        /// </summary>
        StandaloneOSX,
        /// <summary>
        /// Microsoft XBox
        /// </summary>
        XboxOne,
        /// <summary>
        /// Nintendo Switch
        /// </summary>
        Switch,
        /// <summary>
        /// Microsoft UWP
        /// </summary>
        WSAPlayer
    }

    public enum ABCompressType
    {
        None,
        LZ4,
        LZMA
    }
}
